<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj = {
            _msg: '123'
        };
        var _obj = obj
        Object.defineProperty(obj, "msg", {
            get() {
                console.log('获取');
                return this._msg + "666"
            },
            set(value) {
                console.log('设置');
                this._msg = value;
            }
        });
        console.log(obj.msg);
        obj.msg = "修改"
    </script>
</body>

</html>